Nexus Weblogging
V2EX
You are here V2EX > 机械境 > Project Babel > 在windows上安装babel 补充说明

raidybor


0.011%



disconnected
回复主题 | 切换简介显示 | 跳到回复(15)
这两天空了下来,打开v2ex看到很多朋友还是无法安装成功,所以我在这里补充说明一下,希望你们顺利安装成功...

在windows上安装babel 补充说明

... by raidybor ... 11 月 21 天前 ... 505 次点击

首先你一定要懂一点apache和php,要不我也帮不了你,下面我们再次会提到babel在windows上安装的一些问题,主要的问题有如下:

1,为什么必须安装在根目录下
2,为什么一定要将URL重写配置文件写进apache的配置文件

在虚拟机上安装很不爽,为什么babel一定要放到根目上,我们只要作如下改动就可以了,打开文件Settings.php,找到:
define('BABEL_PREFIX', 'd:/usr/www/babel');
这一行是设置babel的根目录,接下来我们新建一个常量

define('BABEL_PREFIXS', 'http://127.0.0.1/babel/htdocs');
请注意,这里是指向了htdocs目录,这样写不支持镜像网站,如果你想支持就写成相对路径比如:/../../htdocs 这种写法我在我的windows xp上测试通过,不知道别的系统也是可以,当然不能写成d:/usr/www/babel/htdocs,为什么你自己想吧...(昨天我用同样的方法将 我的WP改成支持镜像).

加好了这段后我们再打开V2EXCore.php文件,找到这样的代码

echo('<link href="/favicon.ico" rel="shortcut icon" />');
echo('<link rel="stylesheet" type="text/css" href="/css/themes/' . BABEL_THEME . '/css_babel.css" />');
echo('<link rel="stylesheet" type="text/css" href="/css/themes/' . BABEL_THEME . '/css_extra.css" />');
echo('<link rel="stylesheet" type="text/css" href="/css/themes/' . BABEL_THEME . '/css_zen.css" />');
看到这里我相信你一定明白了为什么要装在根目录的原因了,href="/css/themes/'你看href="/c...这个是从htdocs目录开始的,
下面我们将这改成:
echo('<link rel="stylesheet" type="text/css" href="' . BABEL_PREFIXS . '/css/themes/' . BABEL_THEME . '/css_babel.css" />');
当然后面还有很多很多这样的语句,如果你不怕............累............,想做我也不拦你。

对于高手当然不看都懂,但是是新手那就要认真看看了,这是路径的问题不是程序有什么限制,解释一下,

照我那样改写后,路径变成了:(define('BABEL_PREFIXS', 'http://127.0.0.1/babel/htdocs');)前面定义的常量.
这里定义的http://127.0.0.1/babel/htdocs/c...,也就是说我们的路径是完整的了

第二为什么要将babel.conf中的代码加入apache配置文件,不加可以不?很简单:

这是原来的:
RewriteRule ^/$ /babel.php?m=home [L]
RewriteRule ^/index.html$ /babel.php?m=home [L]
RewriteRule ^/home/style/shuffle.html$ /babel.php?m=home&style=shuffle [L]
RewriteRule ^/home/style/remix.html$ /babel.php?m=home&style=remix [L]
RewriteRule ^/home/style/shuffle$ /babel.php?m=home&style=shuffle [L]
RewriteRule ^/home/style/remix$ /babel.php?m=home&style=remix [L]
RewriteRule ^/home/style/remix/([a-zA-Z0-9\-]+)$ /babel.php?m=home&style=remix&go=$1 [L]
RewriteRule ^/remix/([a-zA-Z0-9\-]+)$ /babel.php?m=home&style=remix&go=$1 [L]


这是改后的:
RewriteRule ^$ babel.php?m=home [L]
RewriteRule ^index.html$ babel.php?m=home [L]
RewriteRule ^home/style/shuffle.html$ babel.php?m=home&style=shuffle [L]
RewriteRule ^home/style/remix.html$ babel.php?m=home&style=remix [L]
RewriteRule ^home/style/shuffle$ babel.php?m=home&style=shuffle [L]
RewriteRule ^home/style/remix$ babel.php?m=home&style=remix [L]
RewriteRule ^home/style/remix/([a-zA-Z0-9\-]+)$ babel.php?m=home&style=remix&go=$1 [L]
RewriteRule ^remix/([a-zA-Z0-9\-]+)$ babel.php?m=home&style=remix&go=$1 [L]

最后说明:你要将
<VirtualHost *:80>
ServerName v2ex
ServerAlias babel bbs.livid.cn v2ex.com v2ex.cn www.v2ex.com www.v2ex.cn
ServerAdmin v2ex.livid@gmail.com

DocumentRoot /www/babel/htdocs/
<Directory />
Options Indexes FollowSymLinks
AllowOverride None
</Directory>

<Directory /www/babel/htdocs/>
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

ErrorLog /www/babel/logs/error.log
LogLevel warn

CustomLog /www/babel/logs/access.log combined
</VirtualHost>

这几行全部去掉

如果你像我改成支持虚拟机那样的路径你还要在babel.conf文件开始的地方加一句:
RewriteBase /babel/htdocs/ 这里是说你将这个文件放在那里。

接下来将babel.conf改成.htaccess并复制到htdocs目录中去。

就这样完成了不再需要写入apache的配置文件,也不在必须安装在根目录。

谢谢你能看到这里,因为我写的不通顺,给你带来的阅读问题还请见量,最后要请Livid指正是不是改动这些就可以在不需要安装在根目了

######################### E N D by:raidybor 写作 ##################################
by www.raidybor.com
E-mail:raidybor@gmail.com
skype:raidybor

15 篇回复 | 回到顶部 | 回复主题
1 - 12-24 12:11
Cinner 天王星
  我对apache和php都不懂,在xp上装好后,apache老是自己停止服务,然后就启动不了!不过还是要支持一下楼主,总有一天,我会把它在windows上装成功的,不过到那时,Project Babel可能已经在windows上很容易地安装了。
2 - 12-26 9:50
raidybor 楼主 四川
我用的好好的,我的QQ:79894390,我远程帮你搞定.
3 - 12-28 0:09
Sonic 地球
我的也有问题.我在地址栏上输入http://localhost/babel.php后出现下面的错误.请楼上的帮忙看看是什么问题,对PHP不是太了解


Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\MyProjects\wamp\www\babel\htdocs\core\V2EXCore.php:1) in D:\MyProjects\wamp\www\babel\htdocs\core\V2EXCore.php on line 110

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\MyProjects\wamp\www\babel\htdocs\core\V2EXCore.php:1) in D:\MyProjects\wamp\www\babel\htdocs\core\V2EXCore.php on line 110

Warning: Cannot modify header information - headers already sent by (output started at D:\MyProjects\wamp\www\babel\htdocs\core\V2EXCore.php:1) in D:\MyProjects\wamp\www\babel\htdocs\core\V2EXCore.php on line 180

Warning: Cannot modify header information - headers already sent by (output started at D:\MyProjects\wamp\www\babel\htdocs\core\V2EXCore.php:1) in D:\MyProjects\wamp\www\babel\htdocs\core\V2EXCore.php on line 181

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in D:\MyProjects\wamp\www\babel\htdocs\core\V2EXCore.php on line 4743

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in D:\MyProjects\wamp\www\babel\htdocs\core\V2EXCore.php on line 4763
4 - 3-18 17:51
OnlyBlue 中国
3楼列出的6个警告中,前4个和我一样啊!
用UltraEdit重新编辑,也不行。
v2ex真真是不好装啊!
5 - 3-18 18:01
Leechael Sputnik 1
认真翻查 Project-Babel 区已经存在的帖子吧。
当你注册第一个用户,并且发布第一个帖子后,上面的 warning 会停止的了。
6 - 3-18 18:15
OnlyBlue 中国
想发表帖子都不行,点<b>创建新主题</b>按钮,出现:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\xampp\htdocs\bb\htdocs\core\V2EXCore.php:1) in C:\xampp\xampp\htdocs\bb\htdocs\core\V2EXCore.php on line 112

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\xampp\htdocs\bb\htdocs\core\V2EXCore.php:1) in C:\xampp\xampp\htdocs\bb\htdocs\core\V2EXCore.php on line 112

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\xampp\htdocs\bb\htdocs\core\V2EXCore.php:1) in C:\xampp\xampp\htdocs\bb\htdocs\core\V2EXCore.php on line 182

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\xampp\htdocs\bb\htdocs\core\V2EXCore.php:1) in C:\xampp\xampp\htdocs\bb\htdocs\core\V2EXCore.php on line 183

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\xampp\htdocs\bb\htdocs\core\V2EXCore.php:1) in C:\xampp\xampp\htdocs\bb\htdocs\core\URLCore.php on line 60

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\xampp\htdocs\bb\htdocs\core\V2EXCore.php:1) in C:\xampp\xampp\htdocs\bb\htdocs\core\URLCore.php on line 60
Project Babel | Copyright © 2006 Livid Torvalds
电子公告服务规则 | 使用规则 | 隐私权保护规则 | 禁止性内容规则
$Id: V2EXCore.php 510 2006-07-15 12:40:04Z livid $
7 - 3-18 18:35
Leechael Sputnik 1
使用的是 http://localhost/ 的方式访问自己安装的 Babel?
8 - 3-18 23:48
OnlyBlue 中国
我是参照一个人的建议,忘记是谁了,设置了虚拟主机。
问题解决了!
我用原始文件覆盖了一下修改过的V2EXCore.php,就好了。
谢Leechael!
9 - 3-19 12:02
smilenow 疯人院
已经按楼主的方法存了一个.htaccess到htdocs目录中去,但打开我本地路径http://localhost/babel/htdocs/core/InstallCore.php想进行安装的时候,依然不停地显示以下信息

Install Core init

EX: UPDATE babel_node SET nod_title = 'Board', nod_pid = 2, nod_sid = 2, nod_uid = 1, nod_level = 2, nod_header = 'Hello World!', nod_footer = 'This is an example board in Limbo.', nod_description = '' WHERE nod_id = 3
EX: INSERT INTO babel_channel(chl_pid, chl_url, chl_created) VALUES(3, 'http://www.livid.cn/rss.php', 1174276285)

不知道该怎么操作?谢谢

------------------------
我重来没用过apache、php、mysql用一晚上安装了他们,并反复配置,一会儿这个启动不了,一个那个不认的,终于都启动了,满怀信心地来装 babel…… 又是一系列问题,rewrite是按楼主方法写进去了,结果还是没法装啊,可能是我底子太薄的缘故,但我觉得babel的安装依然缺乏一个简易的安装文 档,或step by step的傻瓜向导。

一上午又耗过去了,今天夜班,在安装失败的郁闷中我将踏出家门……不爽~~~极其不爽
10 - 3-19 12:12
smilenow 疯人院
另外打开http://localhost/babel/htdocs/babel.php
我这报错为:
Warning: require_once(Cache/Lite.php) [function.require-once]: failed to open stream: No such file or directory in C:\webserver\apache\htdocs\babel\htdocs\core\V2EXCore.php on line 23

Fatal error: require_once() [function.require]: Failed opening required 'Cache/Lite.php' (include_path='C:\webserver\apache\htdocs\babel\htdocs/libs/pear:.;C:\php5\pear') in C:\webserver\apache\htdocs\babel\htdocs\core\V2EXCore.php on line 23

经查,其中babel.php第23代码是:
ini_set('include_path', BABEL_PREFIX . '/libs/pear' . ':' . ini_get('include_path'));
11 - 3-19 13:53
Leechael Sputnik 1
Babel 的必须使用 http://www.xxx.com/ 这样的域名下运行,类似 http://www.xxx.com/babel/ 这样的子目录下是无法正常运行的。
你的报错,将 23 行的内容改为:
ini_set('include_path', BABEL_PREFIX . '/libs/pear' . ';' . ini_get('include_path'));
就可以了。
新版本中已经解决了这个问题,你可以从这里下载我打包,含有 Installer 的源码包:
http://www.v2ex.com/topic/view/8456.html
12 - 3-19 16:42
smilenow 疯人院
Leechael,非常感谢,我下班后回家测试~~
13 - 3-19 22:39
﹎sκyˊ☆ 佛山
....
14 - 7-25 11:57
solar 土星
我安装好了,就是rewrite规则不知道该怎么写,我的配置是:
Windows Server 2003,IIS6.0,PHP5.1.4,Mysql5.0.27,用的是IIS的Rewriter组件(Discuz提供),访问http: //xxx/babel.php?m=home这样的URL没问题,而http://xxx/index.html浏览器提示403错误。

下面是我在IIS Rewrite组建里的规则:
#Babel Rewrite规则

RewriteRule ^$ babel.php?m=home [L]
RewriteRule ^index.html$ babel.php?m=home [L]
RewriteRule ^home/style/shuffle.html$ babel.php?m=home&style=shuffle [L]
RewriteRule ^home/style/remix.html$ babel.php?m=home&style=remix [L]
RewriteRule ^home/style/shuffle$ babel.php?m=home&style=shuffle [L]
RewriteRule ^home/style/remix$ babel.php?m=home&style=remix [L]
RewriteRule ^home/style/remix/([a-zA-Z0-9\-]+)$ babel.php?m=home&style=remix&go=$1 [L]
RewriteRule ^remix/([a-zA-Z0-9\-]+)$ babel.php?m=home&style=remix&go=$1 [L]

RewriteRule ^q/(.+)/([0-9]*).html$ babel.php?m=search&q=$1&p=$2 [L]
RewriteRule ^q/(.+)$ babel.php?m=search&q=$1 [L]

RewriteRule ^search/listener.vx$ babel_sl.php?m=search [L]
RewriteRule ^search.vx$ babel.php?m=search [L]

RewriteRule ^savepoint/erase/([0-9]+).vx$ babel_sl.php?m=savepoint_erase&savepoint_id=$1 [L]

RewriteRule ^feed/v2ex.rss$ babel_feed.php?m=home [L]
RewriteRule ^feed/board/([a-zA-Z0-9\-]+).rss$ babel_feed.php?m=board&board_name=$1 [L]

RewriteRule ^me/([0-9]+)$ babel.php?m=user_home&do=me&msg=$1 [L]
RewriteRule ^me$ babel.php?m=user_home&do=me [L]
RewriteRule ^u/(.+)$ babel.php?m=user_home&user_nick=$1 [L]

RewriteRule ^zen$ babel.php?m=zen [L]
RewriteRule ^zen/(.+)$ babel.php?m=zen&user_nick=$1 [L]

RewriteRule ^friend/connect/(.+)$ babel.php?m=user_home&user_nick=$1&do=add [L]
RewriteRule ^friend/remove/(.+)$ babel.php?m=user_home&user_nick=$1&do=remove [L]

RewriteRule ^status.vx$ babel.php?m=status [L]
RewriteRule ^jobs.vx$ babel.php?m=jobs [L]
RewriteRule ^rules.vx$ babel.php?m=rules [L]
RewriteRule ^terms.vx$ babel.php?m=terms [L]
RewriteRule ^privacy.vx$ babel.php?m=privacy [L]
RewriteRule ^policies.vx$ babel.php?m=policies [L]
RewriteRule ^out_of_money.vx$ babel.php?m=out_of_money [L]

RewriteRule ^signup.html$ babel.php?m=signup [L]
RewriteRule ^user/create.vx$ babel.php?m=user_create [L]

RewriteRule ^user/modify.vx$ babel.php?m=user_modify [L]
RewriteRule ^user/update.vx$ babel.php?m=user_update [L]

RewriteRule ^recv/portrait.vx$ babel_sl.php?m=recv_portrait [L]
RewriteRule ^recv/savepoint.vx$ babel_sl.php?m=recv_savepoint [L]

RewriteRule ^recv/zen/project.vx$ babel_sl.php?m=recv_zen_project [L]
RewriteRule ^change/zen/task/done/([0-9]+).vx$ babel_sl.php?m=change_zen_task_done&zen_task_id=$1 [L]
RewriteRule ^change/zen/project/permission/([0-9]+).vx$ babel_sl.php?m=change_zen_project_permission&zen_project_id=$1 [L]

RewriteRule ^erase/zen/project/([0-9]+).vx$ babel_sl.php?m=erase_zen_project&zen_project_id=$1 [L]

RewriteRule ^recv/zen/task/([0-9]+).vx$ babel_sl.php?m=recv_zen_task&zen_project_id=$1 [L]
RewriteRule ^erase/zen/task/([0-9]+).vx$ babel_sl.php?m=erase_zen_task&zen_task_id=$1 [L]

RewriteRule ^undone/zen/task/([0-9]+).vx$ babel_sl.php?m=undone_zen_task&zen_task_id=$1 [L]

RewriteRule ^login/(.+)$ babel.php?m=login&r=$1 [L]
RewriteRule ^login.vx$ babel.php?m=login [L]
RewriteRule ^logout.vx$ babel.php?m=logout [L]

RewriteRule ^passwd/(.+)$ babel.php?m=passwd&k=$1 [L]

RewriteRule ^passwd.vx$ babel.php?m=passwd [L]

RewriteRule ^channel/view/([0-9]*).html$ babel.php?m=channel_view&channel_id=$1 [L]

RewriteRule ^go/([a-zA-Z0-9\-]+)$ babel.php?m=board_view&board_name=$1 [L]

RewriteRule ^board/view/([0-9]*)/([0-9]*).html$ babel.php?m=board_view&board_id=$1&p=$2 [L]
RewriteRule ^board/view/([0-9]*).html$ babel.php?m=board_view&board_id=$1 [L]

RewriteRule ^section/view/([0-9]*).html$ babel.php?m=section_view§ion_id=$1 [L]

RewriteRule ^topic/top.html$ babel.php?m=topic_top [L]
RewriteRule ^topic/fresh.html$ babel.php?m=topic_fresh [L]
RewriteRule ^topic/fresh/([0-9]*).html$ babel.php?m=topic_fresh&p=$1 [L]

RewriteRule ^topic/archive/user/(.+)$ babel.php?m=topic_archive_user&user_nick=$1 [L]

RewriteRule ^topic/favorite.vx$ babel.php?m=topic_favorite [L]
RewriteRule ^topic/favorite/([0-9]*).vx$ babel.php?m=topic_favorite&p=$1 [L]

RewriteRule ^topic/view/([0-9]*)/([0-9]*).html$ babel.php?m=topic_view&topic_id=$1&p=$2 [L]
RewriteRule ^topic/view/([0-9]*).html$ babel.php?m=topic_view&topic_id=$1 [L]
RewriteRule ^topic/new/([0-9]*).vx$ babel.php?m=topic_new&board_id=$1 [L]
RewriteRule ^topic/create/([0-9]*).vx$ babel.php?m=topic_create&board_id=$1 [L]

RewriteRule ^topic/modify/([0-9]*).vx$ babel.php?m=topic_modify&topic_id=$1 [L]
RewriteRule ^topic/update/([0-9]*).vx$ babel.php?m=topic_update&topic_id=$1 [L]
RewriteRule ^topic/erase/([0-9]*).vx$ babel.php?m=topic_erase&topic_id=$1 [L]
RewriteRule ^topic/move/([0-9]*).vx$ babel.php?m=topic_move&topic_id=$1 [L]
RewriteRule ^topic/move/([0-9]*)/to/([a-zA-Z0-9\-]+)$ babel_sl.php?m=topic_move_to&topic_id=$1&board_name=$2 [L]

RewriteRule ^post/create/([0-9]*).vx$ babel.php?m=post_create&topic_id=$1 [L]
RewriteRule ^post/erase/([0-9]*).vx$ babel.php?m=post_erase&post_id=$1 [L]

RewriteRule ^expense/view/([0-9]*).vx$ babel.php?m=expense_view&p=$1 [L]
RewriteRule ^expense/view.vx$ babel.php?m=expense_view [L]

RewriteRule ^online/view/([0-9]*).vx$ babel.php?m=online_view&p=$1 [L]
RewriteRule ^online/view.vx$ babel.php?m=online_view [L]

RewriteRule ^c/([0-9]*).([0-9]*).png$ c.php [L]

RewriteRule ^fav/topic/add/([0-9]*).vx$ babel_ajax.php?m=fav_topic_add&topic_id=$1 [L]
RewriteRule ^fav/node/add/([0-9]*).vx$ babel_ajax.php?m=fav_node_add&node_id=$1 [L]
RewriteRule ^fav/channel/add/([0-9]*).vx$ babel_ajax.php?m=fav_channel_add&channel_id=$1 [L]
RewriteRule ^fav/remove/([0-9]*).vx$ babel_ajax.php?m=fav_remove&fav_id=$1 [L]

RewriteRule ^message/home.vx$ babel_pm.php?m=home [L]
RewriteRule ^message/compose.vx$ babel_pm.php?m=compose [L]
RewriteRule ^message/compose/([0-9]*).vx$ babel_pm.php?m=compose&user_id=$1 [L]
RewriteRule ^message/create.vx$ babel_pm.php?m=create [L]
RewriteRule ^message/inbox.vx$ babel_pm.php?m=inbox [L]
RewriteRule ^message/inbox/([0-9]*).vx$ babel_pm.php?m=inbox&p=$1 [L]
RewriteRule ^message/sent.vx$ babel_pm.php?m=sent [L]
RewriteRule ^message/sent/([0-9]*).vx$ babel_pm.php?m=sent&p=$1 [L]
RewriteRule ^message/view/([0-9]*).vx$ babel_pm.php?m=view&message_id=$1 [L]

RewriteRule ^api/topic/create.vx$ babel_api.php?m=topic_create [L]

RewriteRule ^mobile.html$ babel.php?m=mobile [L]
RewriteRule ^mobile/([0-9]+)$ babel.php?m=mobile&no=$1 [L]

RewriteRule ^man.html$ babel.php?m=man [L]
RewriteRule ^ref/(.+)$ babel.php?m=man&q=$1 [L]

RewriteRule ^newsticker.xml$ babel_sl.php?m=newsticker [L]
15 - 7-25 17:09
solar 土星
呵呵,问题已经解决了,原来是Rewrite规则的问题。有朋友用Windows服务器的话,可以参考http://www.einit.com/user1/165/archives/2007/7794.html
看完之后有话想说?那就帮楼主加盖一层吧!


当前热门主题  翻墙新运动,数羊。 ... 41 篇回复
© 2007 A Xin Liu Production   -   About
a site powered by Project Babel